package in

import (
	"encoding/json"

	"github.com/gogf/gf/net/ghttp"
)

type ExitModel struct {
	Key   string      //退出类型
	Code  int         //状态码
	Value interface{} //退出内容
}

func newExitHttp(code int, data interface{}) string {
	l := ExitModel{
		Key:   ExitHttpDone,
		Code:  code,
		Value: data,
	}
	bs, _ := json.Marshal(l)
	return string(bs)
}

func (this ExitModel) exit(r *ghttp.Request) {
	switch this.Key {
	case ExitHttpDone:
		writeJson(r, this.Code, this.Value)
	}
}
